package com.ccq.farm.shiro.ec;/**
 * Created by HiWin10 on 2018-07-01.
 */

import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.subject.Subject;
import org.apache.shiro.web.filter.authc.FormAuthenticationFilter;
import org.apache.shiro.web.util.WebUtils;

import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

/**
 * @author ccq
 * @create 2018-07-01 下午 14:00
 **/
public class EcFormAuthenticationFilter extends FormAuthenticationFilter {

    @Override
    protected boolean onLoginSuccess(AuthenticationToken token, Subject subject, ServletRequest request, ServletResponse response) throws Exception {
        subject.getSession().setAttribute("ua",token);
        WebUtils.issueRedirect(request, response, getSuccessUrl());
        return false;
    }

}
